﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShareFrame.Util.ClassLibrary
{
    /// <summary>
    /// 第三方应用配置常量类
    /// </summary>
    public class ThirdAppConfigConst
    {
        /// <summary>
        /// 微信授权常量
        /// </summary>
        public class ThirdAppWeChatConst
        {
            /// <summary>
            /// 授权接口地址
            /// </summary>
            public const string APP_CONNECT_URL = "https://open.weixin.qq.com/connect/qrconnect";
            /// <summary>
            /// 获取access_token的URL地址
            /// </summary>
            public const string APP_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token";
            /// <summary>
            /// 获取详细用户信息
            /// </summary>
            public const string APP_USERINFO_URL = "https://api.weixin.qq.com/sns/userinfo";

            /// <summary>
            /// 拼接获取用户登录
            /// openid         用户唯一标识
            /// session_key    会话密钥         
            /// unionid        用户在开放平台的唯一标识符
            /// errcode        错误码 -1(系统繁忙)  0(请求成功)   40029(code 无效)   45011(频率限制，每个用户每分钟100次) 40226(高风险等级用户)
            /// errmsg         错误信息            
            /// </summary>
            /// <param name="appId">小程序 appId</param>
            /// <param name="appSecret">小程序 appSecret</param>
            /// <param name="js_code">登录时获取的 code</param>
            /// <returns></returns>
            public static string GetLoginByCode(string appId,string appSecret,string js_code) 
            {
                return string.Format("https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code",appId,appSecret,js_code);
            }

        }


        /// <summary>
        /// 支付宝授权常量
        /// </summary>
        public class ThridAppAlipayConst
        {
            /// <summary>
            /// oauth2授权
            /// </summary>
            public const string APP_CONNECT_URL = "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?";
            /// <summary>
            /// app_auth_token
            /// </summary>
            public const string APP_AUTH_TOKEN = "alipay.open.auth.token.app";
            /// <summary>
            /// 支付宝通用接口
            /// </summary>
            public const string ALI_PUBLIC_API = @"https://openapi.alipay.com/gateway.do";
            /// <summary>
            /// 外部 H5 唤起支付宝客户端进行实名认证接口地址
            /// </summary>
            public const string ALI_ALIPAYAPP_AUTH = @"alipays://platformapi/startapp?appId=20000067&url=";
        }


    }
}
